<?php

/**
 * Produit form base class.
 *
 * @package    TC5
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormGeneratedTemplate.php 12815 2008-11-09 10:43:58Z fabien $
 */
class BaseProduitForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'            => new sfWidgetFormInputHidden(),
      'categorie_id'  => new sfWidgetFormPropelChoice(array('model' => 'Categorie', 'add_empty' => true)),
      'nom'           => new sfWidgetFormInput(),
      'prix_ht'       => new sfWidgetFormInput(),
      'stock'         => new sfWidgetFormInput(),
      'description'   => new sfWidgetFormTextarea(),
      'note_moyenne'  => new sfWidgetFormInput(),
      'date_creation' => new sfWidgetFormDate(),
      'img_url'       => new sfWidgetFormInput(),
    ));

    $this->setValidators(array(
      'id'            => new sfValidatorPropelChoice(array('model' => 'Produit', 'column' => 'id', 'required' => false)),
      'categorie_id'  => new sfValidatorPropelChoice(array('model' => 'Categorie', 'column' => 'id', 'required' => false)),
      'nom'           => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'prix_ht'       => new sfValidatorNumber(array('required' => false)),
      'stock'         => new sfValidatorInteger(array('required' => false)),
      'description'   => new sfValidatorString(array('required' => false)),
      'note_moyenne'  => new sfValidatorNumber(array('required' => false)),
      'date_creation' => new sfValidatorDate(array('required' => false)),
      'img_url'       => new sfValidatorString(array('max_length' => 255, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('produit[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Produit';
  }


}
